home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 4
/
Amiga Tools 4.iso
/
tools
/
system-tools
/
sort1.45e
/
sort.doc
< prev
next >
Wrap
Text File
|
1996-02-26
|
8KB
|
215 lines
sort.doc sort Version 1.45 by Rüdiger Werner
The program and files in this distribution are freely distributable.
No commercial usage is permitted without written permission from the
author. Everything in this distribution must be kept together, in original
unmodified form.
*************************
***********************************************************************
* Notice that the author can't be made responsible for the destroying *
* or lost of data through use of this program. You use it on your own *
* risc. Please read carefully the Doc-file before using. *
***********************************************************************
This copy is not registered. For registration send a letter with 5 US$ or
the equivalent in DM to the below mentioned address. If you give an e-mail
address, you will get the registered version via this medium. Otherwise
include an addressed and franked envelope (2DM within Germany) or
two more US$ for shipping. Send cash only, for checks add 5 US$ for the
charges of the bank.
*************************
Please contact me if you have any comments or suggestions:
E-Mail: rw2@irz.inf.tu-dresden.de
wernerr@iee1.et.tu-dresden.de
URL: http://home.pages.de/~wernerr
http://www.inf.tu-dresden.de/~rw2
http://eeetw0.et.tu-dresden.de:8080/~wernerr
Snail
Mail: Rüdiger Werner
Stresemannplatz 2
01309 Dresden
GERMANY
CHANGES TO LAST VERSION
loading speed increased
sorting time reduced downto 10 per cent or less
no (recognizable) time is needed anymore for freeing the memory
-c option changed
-C option added
-i option added
-S option added
-v option added
Description
-----------
The program was written for use in Shell only.
It is started either by simply typing it's name (of course it should be
in the current directory or in the path) or by giving additionally switches
and/or the name of the file what should be sorted.
sort [switches] infile [infile 2 ... ] [outfile]
By typing 'sort ?' appears a short help.
The specified file is opened and red into the memory. There it will be
sorted and, if any switches were set, manipulated in the required way.
Explanation of the switches (alphabeticially order):
NOTE: In the unrgistered version only the -a, -e and -g switches are working.
-----------------------------------------------------------------------------
-a sorting the file in ascending order (it is optional, because default)
-c[z,l] with this option the number 'z' of column can be specified, by which
the file is to be sorted. 'l' specifies, how many chars are used for
sorting.
This is useful e.g. to sort the RECENT files from Aminet by type.
(-c20,10)
If double lines are erased, the comparision starts at the FIRST char
of the lines, means the whole line is used for comparision.
If 'l' is not given, it will be asked for, if 'l' given as '0' it
will be set automatical to maximum line length
-C[z,l] see above
The difference is, that the comparision for erasing double
lines starts at the column, which is specified for sorting.
comparision is made till end of the line, the number of chars
for sorting doesn't have any influence.
-d sorting the file in descending order
-e all empty lines will be erased.
-E all empty lines and all identical lines in the file will be erased
after sorting (of course ONE of these lines is kept in the file).
-f[y] using this option the first line of the work range can be specified
If this option is given, ALL actions are done ONLY within this range.
To give also the last line is not compelling.
If y is bigger than the number of lines of the internal file
(all in-read files together) an error-message appears and the
program is cancelled.
-g actually the capitals and small letters are distinguished.
by setting this switch, they won't be distinguished.
-i[str] the given string is ignored for sorting, if it appears
on the beginning of the sorting column. It's NOT removed!
if spaces are in the string, it's advicable to give the -i
option only in the command line and answer the request.
For deleting the full line is used for comparision.
-j[x] joins x files and sorts them; the resulting file will be
written to <outfile>.
-J[x] joins x files without sorting; the resulting file will be
written to <outfile>.
-l[y] using this option the first line of the work range can be specified
If this option is given, ALL actions are done ONLY within this range.
To give also the first line is not compelling.
if y is bigger than the number of lines of the internal file
(all in-read files together) the last line of the file is
automatically taken as last line of the range.
if x or/and y is not given it will be asked for
-n the file is not sorted, only empty lines are erased.
-N the file is not sorted, only empty lines and identical lines which
are side by side are erased (of course ONE line is kept in the file).
Note that it might more useful if the file is already sorted.
-o the specified file for reading will be overwritten by the sorted
file.
BE CAREFUL!!! IF ONCE OVERWRITTEN THE ORIGINAL FILE CAN'T BE RESTORED!!!
-p[str] all lines, which doesn't match the search pattern str will be removed.
note: if characters like " are given it is advisable to give
this switch as the very last of the command line. The reason is that
the following arguments are not recognized after a " by the programm.
-P[str] all lines, which match the search pattern str will be removed
note: see -p
-r the file which was red will only be written in reverse order of lines
without any other actions
-s[c] with this option the character c will be removed from the file/range.
note: if characters like " need to be removed it is advisable to give
this switch as the very last of the command line. The reason is that
the following arguments are not recognized after a " by the programm.
-S[cd] with this option the char c will be replaced by char d in the
file/range.
note: see -s[c]
-v this option supresses all messages, including the warning, that the
outfile already exists.
Only error messages will appear.
-x the sorting function will be disabled
some examples:
sort textfile1
asks for the outfilename and loads textfile1. After sorting it will be
written to outfile
sort textfile1 text.out -g
loads textfile1 without distinguishing capitals and small letters and
writes the sorted file to text.out
sort textfile1 textfile2 -j3 textfile3 ram:text.out -E
loads textfile1 textfile2 and textfile3 sorts, removes all empty lines
and all identical lines (except of one of them) and writes the
list to RAM:text.out
sort RECENT RECENT.sort -E -c20,10 -g -f6
is the common command line to sort the RECENT files from Aminet
sorting starts at line 6, means the header is not touched
it is sorted after the types of the files, additionally the entries
are sorted after the first column
empty lines and identical lines are deleted
(the whole line is used for comparision)
******
The switches can be set at any place after the program name.
If the parameter to the switch is not given, it will be asked for.
The program detects contradictions between given switches to avoid possible
mistakes from the user
Notice that the outfilename has to be the last of all filenames.
If no outfilename is given, the first infilename plus a new ending is used
for a suggestion for the outfilename.
The sort-order bases on the strcmp/stricmp function.
The maximum length of a line in a file is 1024 byte.
All bytes that a line is longer than this are cutted. A message appears in
this case. If you need to sort longer lines, just send me a mail.
The size of the file to be sorted depends only on the size of the available
memory (and on your patience). The used time is shown after sorting, just
for your statistics ...
The sort_engl file is the same as the sort file, just all messages appear
in English.
I'd be grateful for any comments, suggestions and bug reports.
Rüdiger Werner